package com.youkeda.excise;

import java.util.ArrayList;

/**
 * @author CoderXshuai
 * @date 2020/7/17/0017 1:29
 */

public class HashSearch {
    public static ArrayList<Character> repeat(String str) {
        ArrayList<Character> result = new ArrayList<>();
        int[] exists = new int[26];
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if (exists[c - 'a'] == 1) {
                result.add(c);
            } else {
                exists[c - 'a'] = 1;
            }
        }
        return result;
    }

    public static void main(String[] args) {
        String str = "abcdkioudofanzdfpqwe";
        System.out.println(repeat(str));
    }
}
